package cn.tedu.net.address;

import java.net.InetSocketAddress;

public class InetSocketAddressDemo {
    public static void main(String[] args) {
        //创建代表IP地址和端口号的类的对象
        //localhost解析成IP地址---127.0.0.1永远指向本地
        InetSocketAddress isa=new InetSocketAddress
                ("localhost",8080);

        //返回IP地址
        System.out.println(isa.getAddress());
        //返回主机名
        System.out.println(isa.getHostName());
    }
}
